#include<jsoncpp/json/json.h>
#include<iostream>

int main()
{
    Json::Value root;
    root["x"]=100;
    root["y"]=200;
    root["op"]='+';
    root["desc"]="this is a +oper";
    Json::StyledWriter w;

    Json::FastWriter f;

    std::string res=w.write(root);
    
    std::cout<<res<<std::endl;
    //反序列化
    Json::Value v;
    Json::Reader r;
    r.parse(res,v);

    int x=v["x"].asInt();
    int y=v["y"].asInt();
    char op=v["op"].asInt();
    std::string desp=v["desc"].asString();

    std::cout<<x<<std::endl;
    std::cout<<y<<std::endl;
    std::cout<<op<<std::endl;
    std::cout<<desp<<std::endl;
}